package com.example.administrator.myapplication;

import android.content.Context;
import android.text.Layout;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;

public class AddMerccandiseAdapterActivity extends BaseAdapter {
    private Context mContext;
    public ArrayList<AddMerchandiseListActivity> data = new ArrayList<>();

    public AddMerccandiseAdapterActivity(Context context) {
        this.mContext=context;
    }

    public void setData(ArrayList<AddMerchandiseListActivity> list){

        data.addAll(list);
        Log.i("23123","(((((((((((((((((________________");
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        viewHolder viewHolder;
        if (convertView==null){
            LayoutInflater inflater=LayoutInflater.from(mContext);
           convertView= inflater.inflate(R.layout.activity_merchandise,null);
            viewHolder=new viewHolder();
            viewHolder.tast1=convertView.findViewById(R.id.tast1);
            convertView.setTag(viewHolder);
        }
        else {
            viewHolder=(viewHolder)convertView.getTag();
        }
        viewHolder.tast1.setText(this.data.get(position).goods_name);

        return convertView;
    }
  class viewHolder{
        TextView tast1;
  }
}

